home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Draw Editor / Source / DrawContent.h < prev    next >
Encoding:
Text File  |  1995-12-11  |  6.9 KB  |  260 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DrawContent.h
  3.  
  4.     Contains:    CDrawContent, CPartContent, CPartialContent
  5.  
  6.     Written by:    Adapted from Selection.h by Mike Halpin.
  7.     
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. // -- DrawEditor Includes --
  12.  
  13. #ifndef _DRAWCONTENT_
  14. #define _DRAWCONTENT_
  15.  
  16. #ifndef _COMPILERDEFS_
  17. #include "CompDefs.h"
  18. #endif
  19.  
  20. #ifndef _DRAWEDITORDEF_
  21. #include "DrawEditorDef.h"
  22. #endif
  23.  
  24. #ifndef _PALETTE_
  25. #include "Palette.h"
  26. #endif
  27.  
  28. // -- OpenDoc Utilities --
  29.  
  30. #ifndef _ALTPOINT_
  31. #include "AltPoint.h"
  32. #endif
  33.  
  34. //=============================================================================
  35. // Forward Declarations
  36. //=============================================================================
  37. class DrawEditor;
  38. class CSelection;
  39. class CShape;
  40. class CEmbeddingShape;
  41. class CCloneInfo;
  42. class CSubscribeLink;
  43. class CPublishLink;
  44. class COrderedList;
  45.  
  46.  
  47. //=============================================================================
  48. // CDrawContent
  49. //=============================================================================
  50. class CDrawContent
  51. {
  52. public:
  53.     
  54.     // -- Init --
  55.     CDrawContent(DrawEditor* editor, COrderedList* shapes, COrderedList* pLinks, COrderedList* sLinks);
  56.     CDrawContent(DrawEditor* editor);
  57.     virtual ~CDrawContent();
  58.         
  59. public:
  60.         
  61.     // -- Accessors --
  62.     DrawEditor*            GetDrawEditor() const;
  63.     
  64.     COrderedList*        GetShapeList() const;
  65.     COrderedList*        GetPublishLinks() const;
  66.     COrderedList*        GetSubscribeLinks() const;
  67.     
  68.     // -- Modify Content
  69.     virtual void         AddShape(Environment* ev, CShape* shape) = 0;    
  70.     virtual void        AddShapeToPart(Environment *ev, CShape* shape) = 0;
  71.     
  72.     // -- Embedding --
  73.     virtual CEmbeddingShape*    IsOneEmbeddedShape(Environment* ev) const;
  74.     
  75.     // -- Storage --
  76.     virtual void        Externalize(Environment* ev, 
  77.                                     ODStorageUnit* storage, 
  78.                                     CCloneInfo* info); 
  79.     
  80.     virtual void        ExternalizeSingleEmbeddedFrame(Environment* ev, 
  81.                                     ODStorageUnit* storage, 
  82.                                     CCloneInfo* cloneInfo,
  83.                                     ODFrame* embeddedFrame); 
  84.     
  85.     virtual void        Internalize(Environment* ev, 
  86.                                     ODStorageUnit* storage, 
  87.                                     CCloneInfo* info); 
  88.     
  89.     virtual void        InternalizeSingleEmbeddedFrame(Environment* ev, 
  90.                                     ODStorageUnit* storageUnit, 
  91.                                     CCloneInfo* info);
  92.                                     
  93.     virtual void          InternalizeForeignContent(Environment* ev,  
  94.                                                 ODStorageUnit* storage,
  95.                                                 CCloneInfo* info);
  96.  
  97.     void                 HandleInternalizeContent(Environment* ev, 
  98.                                             ODStorageUnit* su, 
  99.                                             CCloneInfo* info);
  100.     
  101.     void                 HandleTranslateContent(Environment* ev, 
  102.                                             ODStorageUnit* storage, 
  103.                                             CCloneInfo* info,
  104.                                             ODBoolean doEmbed);
  105.     
  106.  
  107.     void AddPublishLink(CPublishLink* link);
  108.  
  109.     void AddSubscribeLink(CSubscribeLink* link);
  110.  
  111.     void RemoveSubscribeLink(CSubscribeLink* link);
  112.  
  113.     void RemovePublishLink(CPublishLink* link);
  114.     
  115.  
  116.     
  117.  
  118.     ODULong Count();
  119.     void ExternalizeLinks(Environment *ev,  ODStorageUnit *drawSU,  CCloneInfo *cloneInfo);
  120.  
  121.     void ExternalizeSingleFrameLinks(Environment *ev,  ODStorageUnit *drawSU,  CCloneInfo *cloneInfo);
  122.  
  123.     void MergeSingleFrameSubLink( Environment *ev,  ODStorageUnit *su,  CCloneInfo *info, COrderedList* shapeList, ODULong& offset);
  124.  
  125.     void MergeSingleFramePubLink( Environment *ev,  ODStorageUnit *su,  CCloneInfo *info, COrderedList* shapeList, ODULong& offset);
  126.  
  127.     void InternalizeSubLinks( Environment *ev,  ODStorageUnit *su,  CCloneInfo *cloneInfo, CShape** shapeTable);
  128.     void InternalizePubLinks( Environment *ev,  ODStorageUnit *su,  CCloneInfo *cloneInfo, CShape** shapeTable);
  129.     void InternalizeSingleEmbeddedFrameLinks(Environment* ev,  ODStorageUnit* storageUnit,  CCloneInfo* cloneInfo);
  130.  
  131.     void  PostCloneInternalizeLinks(Environment* ev, CShape* shape);
  132.     virtual void AddPublisherToPart(Environment* ev, CPublishLink* pLink);
  133.  
  134.     virtual void AddSubscriberToPart(Environment* ev, CSubscribeLink* sLink);
  135.  
  136.  
  137.     
  138. //----------------------------------------------------------------------------------------
  139. // Data Members
  140. //
  141. protected:
  142.     DrawEditor*            fDrawEditor;
  143.     COrderedList*        fShapeList;    
  144.     COrderedList*        fPublishLinks;
  145.     COrderedList*        fSubscribeLinks;
  146.     
  147.     
  148. };
  149.  
  150. //=============================================================================
  151. // CPromiseContent
  152. //=============================================================================
  153. class CPromiseContent : public CDrawContent
  154. {
  155. public:
  156.     
  157.     // -- Init --
  158.     CPromiseContent(DrawEditor* editor, COrderedList* shapeList);
  159.     CPromiseContent(CDrawContent* content);
  160.     virtual ~CPromiseContent();
  161.         
  162. public:
  163.  
  164.     // -- Storage --
  165.     virtual void        Externalize(Environment* ev, 
  166.                                     ODStorageUnit* storage, 
  167.                                     CCloneInfo* cloneInfo); 
  168.     
  169.     // -- Content --
  170.     virtual void    AddShapeToPart(Environment *ev, CShape* shape);
  171.     virtual void    AddShape(Environment *ev, CShape* shape);
  172.     
  173.     
  174.  
  175. };
  176.  
  177. //=============================================================================
  178. // CSubscribeContent
  179. //=============================================================================
  180. class CSubscribeContent : public CDrawContent
  181. {
  182. public:
  183.     CSubscribeContent(DrawEditor* editor, COrderedList* shapes, CSubscribeLink* subscribeLink);
  184.     virtual ~CSubscribeContent();
  185.     
  186. public:
  187.         
  188.     virtual void        AddShapeToPart(Environment *ev, CShape* shape);
  189.     virtual void        AddShape(Environment *ev, CShape* shape);
  190.     
  191. private:
  192.     CSubscribeLink*      fSubscribeLink;
  193. };
  194.  
  195.  
  196. //=============================================================================
  197. // CSelectionContent
  198. //=============================================================================
  199. class CSelectionContent : public CDrawContent
  200. {
  201. public:
  202.     CSelectionContent(DrawEditor* editor, 
  203.                                         COrderedList* shapes,
  204.                                         COrderedList* pLinks,
  205.                                         COrderedList* sLinks,
  206.                                         CSelection* selection);
  207.     virtual ~CSelectionContent();
  208.     
  209. public:
  210.         
  211.     // -- Storage --
  212.     virtual void        Externalize(Environment* ev, 
  213.                                     ODStorageUnit* storage, 
  214.                                     CCloneInfo* cloneInfo); 
  215.     
  216.     // -- Content --
  217.     
  218.     virtual void        AddShapeToPart(Environment *ev, CShape* shape);
  219.     virtual void         AddShape(Environment *ev, CShape* shape);
  220.     virtual void AddSubscriberToPart(Environment* ev, CSubscribeLink* sLink); //Override
  221.  
  222.     
  223. private:
  224.     CSelection*         fSelection;
  225.  
  226. };
  227.  
  228.  
  229. //=============================================================================
  230. // CPartContent
  231. //=============================================================================
  232. class CPartContent : public CDrawContent
  233. {
  234. public:
  235.     
  236.     // -- Init --
  237.     CPartContent(DrawEditor* editor, COrderedList* shapes, COrderedList* pLinks, COrderedList* sLinks);
  238.     virtual ~CPartContent();
  239.         
  240. public:
  241.         
  242.     // -- Storage --
  243.     virtual void        Externalize(Environment* ev, 
  244.                                     ODStorageUnit* storage, 
  245.                                     CCloneInfo* cloneInfo); 
  246.     
  247.     // -- Content --
  248.     
  249.     virtual void    AddShapeToPart(Environment *ev, CShape* shape);
  250.     virtual void    Add(Environment* ev, CShape* shape);
  251.     virtual void    AddShape(Environment* ev, CShape* shape);
  252.     virtual void AddPublisherToPart(Environment* ev, CPublishLink* pLink); //Override
  253.  
  254.     virtual void AddSubscriberToPart(Environment* ev, CSubscribeLink* sLink); //Override
  255.  
  256.         
  257. };
  258.  
  259.  
  260. #endif